<template>
  <div>
    <label>
      <input type="text" v-model="text">
    </label>
    <button @click="addItem">添加</button>
  </div>
</template>

<script>
  export default {
    name: 'TestInput',
    data() {
      return {
        text: ''
      }
    },
    methods: {
      addItem() {
        let data = {
          text: this.text,
          ext: {
            userInfo: {
              username: "zhangsan",
              age: 18,
              addr: "wuhan"
            }
          }
        };

        this.$emit('add', data);
      }
    }
  }
</script>

<style scoped>

</style>
